package com.rk.kbk.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.rk.kbk.common.DateJsonDeserializer;
import com.rk.kbk.common.DateJsonSerializer;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Order
 * @订单(order)
 * @version : Ver 1.0
 */
@Entity
@Table(name="orders")
public class Order implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * @备注:配送订单
	 * @字段:id BIGINT(19)
	 */
	@Id
	@GeneratedValue(strategy= GenerationType.IDENTITY)
	@GenericGenerator(name="auto-identity",strategy="identity")
	@Column(updatable = false, columnDefinition="BIGINT(19) COMMENT '配送订单'")
	private java.lang.Long id;

	/**
	 * @备注:商家id
	 * @字段:shop BIGINT(19)
	 */
	@ManyToOne
	@JoinColumn(name="shop", columnDefinition="BIGINT(10) COMMENT '商家id'")
	private User shop;

	/**
	 * @备注:骑手id
	 * @字段:ride BIGINT(19)
	 */
	@ManyToOne
	@JoinColumn(name="ride", columnDefinition="BIGINT(10) COMMENT '骑手id'")
	private User ride;

	/**
	 * @备注:货物价格
	 * @字段:goods_money DOUBLE(10)
	 */
	@Column( columnDefinition="DOUBLE(10) COMMENT '货物价格'")
	private Double goodsMoney;


	/**
	 * @备注:订单号
	 * @字段:order_number VARCHAR(255)
	 */
	@Column(columnDefinition="VARCHAR(255) COMMENT '订单号'")
	private java.lang.String orderNumber;

	/**
	 * @备注:商家日订单序号
	 * @字段:day_order_index INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '商家日订单序号'")
	private java.lang.Integer dayOrderIndex;

	/**
	 * @备注:商家发货地址
	 * @字段:address_shop INT(10)
	 */
	@ManyToOne
	@JoinColumn(name="address_shop", columnDefinition="INT(10) COMMENT '商家发货地址'")
	private Address addressShop;

	/**
	 * @备注:收货地址id
	 * @字段:address_user INT(10)
	 */
	@ManyToOne
	@JoinColumn(name="address_user", columnDefinition="INT(10) COMMENT '收货地址id'")
	private Address addressUser;

	/**
	 * @备注:距离(我-取-收)
	 * @字段:distance VARCHAR(66)
	 */
	@Column(columnDefinition="VARCHAR(66) COMMENT '距离(我-取-收)'")
	private java.lang.String distance;

	/**
	 * @备注:配送费
	 * @字段:send_money DOUBLE(22)
	 */
	@Column(columnDefinition="DOUBLE(22) COMMENT '配送费'")
	private java.lang.Double sendMoney;

	/**
	 * @备注:订单小费
	 * @字段:order_tip DOUBLE(22)
	 */
	@Column(columnDefinition="DOUBLE(22) COMMENT '订单小费'")
	private java.lang.Double orderTip;

	/**
	 * @备注:变更费用
	 * @字段:change_money DOUBLE(22)
	 */
	@Column(columnDefinition="DOUBLE(22) COMMENT '变更费用'")
	private java.lang.Double changeMoney;

	/**
	 * @备注:货款
	 * @字段:take_money DOUBLE(22)
	 */
	@Column(columnDefinition="DOUBLE(22) COMMENT '货款'")
	private java.lang.Double takeMoney;

	/**
	 * @备注:订单备注
	 * @字段:order_mark VARCHAR(300)
	 */
	@Column(columnDefinition="VARCHAR(300) COMMENT '订单备注'")
	private java.lang.String orderMark;

	/**
	 * @备注:规定送达时间
	 * @字段:send_time VARCHAR(255)
	 */
	@Column(columnDefinition="VARCHAR(255) COMMENT '规定送达时间'")
	private java.util.Date sendTime;

	/**
	 * @备注:订单状态(出货/损坏/取货/送货/送达/取消)1表示待抢单,2表示待取货,3表示配送中,4表示已送达,5表示出货异常,6表示货物损坏,7表示收货异常,8表示订单取消
	 * @字段:order_status VARCHAR(88)
	 */
	@Column(columnDefinition="VARCHAR(88) COMMENT '订单状态(出货/损坏/取货/送货/送达/取消)1表示待抢单,2表示待取货,3表示配送中,4表示已送达,5表示出货异常,6表示货物损坏,7表示收货异常,8表示订单取消'")
	private java.lang.Integer orderStatus;

	/**
	 * @备注:是否取货异常,默认0表示正常,1表示异常
	 * @字段:is_take_except INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '是否取货异常,默认0表示正常,1表示异常'")
	private java.lang.Integer isTakeExcept;

	/**
	 * @备注:增加订单配送时间(出货异常)
	 * @字段:add_send_time INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '增加订单配送时间(出货异常)'")
	private java.lang.Integer addSendTime;

	/**
	 * @备注:
	 * @字段:add_send_money DOUBLE(22)
	 */
	@Column(columnDefinition="DOUBLE(22) COMMENT ''")
	private java.lang.Double addSendMoney;

	/**
	 * @备注:订单日志,如:出货异常,增加时间/费用,同意/驳回(图片理由)
	 * @字段:order_log TEXT(65535)
	 */
	@Column(columnDefinition="TEXT(65535) COMMENT '订单日志,如:出货异常,增加时间/费用,同意/驳回(图片理由)'")
	private java.lang.String orderLog;

	/**
	 * @备注:货物是否损坏,默认0表示正常,1表示损坏
	 * @字段:is_goods_bad INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '货物是否损坏,默认0表示正常,1表示损坏'")
	private java.lang.Integer isGoodsBad;

	/**
	 * @备注:是否收货异常,默认0表示不正常,1表示异常
	 * @字段:is_send_except INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '是否收货异常,默认0表示不正常,1表示异常'")
	private java.lang.Integer isSendExcept;

	/**
	 * @备注:商家好评,默认1表示好评,2表示差评
	 * @字段:is_ok INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '商家好评,默认1表示好评,2表示差评'")
	private java.lang.Integer isOk;

	/**
	 * @备注:异常内容,1表示地址错误,2表示电话号码错误,3表示无人接听
	 * @字段:except_log VARCHAR(255)
	 */
	@Column(columnDefinition="VARCHAR(255) COMMENT '异常内容,1表示地址错误,2表示电话号码错误,3表示无人接听'")
	private java.lang.Integer exceptLog;

	/**
	 * @备注:订单产生时间
	 * @字段:gmt_datetime DATETIME(19)
	 */
	@Column(updatable = false, columnDefinition="DATETIME(19) COMMENT '订单产生时间'")
	@JsonSerialize(using=DateJsonSerializer.class)
	@JsonDeserialize(using=DateJsonDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
	private java.util.Date gmtDatetime = new java.util.Date();

	/**
	 * @备注:骑手抢单时间
	 * @字段:rob_datetime DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '骑手抢单时间'")
	private java.util.Date robDatetime;

	/**
	 * @备注:骑手取货时间(可以填写)
	 * @字段:get_datetime DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '骑手取货时间(可以填写)'")
	private java.util.Date getDatetime;

	/**
	 * @备注:送达时间
	 * @字段:send_datetime DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '送达时间'")
	private java.util.Date sendDatetime;

	/**
	 * @备注:是否驳回
	 * @字段:is_incubator_delivery int(2)
	 */
	@Column(columnDefinition="INT(11) COMMENT '是否保温箱派送（默认0不是、1是）'")
	private java.lang.Integer isIncubatorDelivery;

	/**
	 * @备注:是否驳回
	 * @字段:is_rebut int(2)
	 */
	@Column(columnDefinition="INT(2) COMMENT '是否驳回'")
	private java.lang.Integer isRebut;

	/**
	 * @备注:驳回证据图片
	 * @字段:is_rebut int(2)
	 */
	@Column(columnDefinition="VARCHAR(200) COMMENT '驳回证据图片'")
	private java.lang.String orderLogImg;

	/**
	 * @备注:修改时间
	 * @字段:upt_datetime DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '修改时间'")
	@JsonSerialize(using=DateJsonSerializer.class)
	@JsonDeserialize(using=DateJsonDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
	private java.util.Date uptDatetime = new java.util.Date();



	private  java.lang.Integer  limitTime;//限制配送时间

	private  java.lang.Integer  isCancelOrder;//是否取消订单  骑手要求商家取消订单1代表是2代表不是（出货异常使用）

	public SortType getSortType() {
		return sortType;
	}

	public void setSortType(SortType sortType) {
		this.sortType = sortType;
	}

	@Transient
	private Account account;
	@Transient
    private  SortType sortType;
	@Transient
	private List<SortType> sortTypeList;
	@Transient
	private Long nowTime;

	public Long getNowTime() {
		return nowTime;
	}

	public void setNowTime(Long nowTime) {
		this.nowTime = nowTime;
	}

	public String getOrderLogImg() {
		return orderLogImg;
	}

	public Double getGoodsMoney() {
		return goodsMoney;
	}

	public void setGoodsMoney(Double goodsMoney) {
		this.goodsMoney = goodsMoney;
	}

	public void setOrderLogImg(String orderLogImg) {
		this.orderLogImg = orderLogImg;
	}

	public List<SortType> getSortTypeList() {
		return sortTypeList;
	}

	public void setSortTypeList(List<SortType> sortTypeList) {
		this.sortTypeList = sortTypeList;
	}

	public Order(){
	}

	public Order(
		java.lang.Long id
	){
		this.id = id;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public void setId(java.lang.Long id) {
		this.id = id;
	}

	public java.lang.Long getId() {
		return this.id;
	}

	public User getShop() {
		return shop;
	}

	public void setShop(User shop) {
		this.shop = shop;
	}

	public User getRide() {
		return ride;
	}

	public void setRide(User ride) {
		this.ride = ride;
	}

	public void setOrderNumber(java.lang.String orderNumber) {
		this.orderNumber = orderNumber;
	}

	public java.lang.String getOrderNumber() {
		return this.orderNumber;
	}


	public void setDayOrderIndex(java.lang.Integer dayOrderIndex) {
		this.dayOrderIndex = dayOrderIndex;
	}

	public java.lang.Integer getDayOrderIndex() {
		return this.dayOrderIndex;
	}


	public Address getAddressShop() {
		return addressShop;
	}

	public void setAddressShop(Address addressShop) {
		this.addressShop = addressShop;
	}

	public Address getAddressUser() {
		return addressUser;
	}

	public void setAddressUser(Address addressUser) {
		this.addressUser = addressUser;
	}

	public void setDistance(java.lang.String distance) {
		this.distance = distance;
	}

	public java.lang.String getDistance() {
		return this.distance;
	}

	public Integer getLimitTime() {
		return limitTime;
	}

	public void setLimitTime(Integer limitTime) {
		this.limitTime = limitTime;
	}

	public void setSendMoney(java.lang.Double sendMoney) {
		this.sendMoney = sendMoney;
	}

	public java.lang.Double getSendMoney() {
		return this.sendMoney;
	}

	public Integer getIsCancelOrder() {
		return isCancelOrder;
	}

	public void setIsCancelOrder(Integer isCancelOrder) {
		this.isCancelOrder = isCancelOrder;
	}

	public void setOrderTip(java.lang.Double orderTip) {
		this.orderTip = orderTip;
	}

	public java.lang.Double getOrderTip() {
		return this.orderTip;
	}


	public void setChangeMoney(java.lang.Double changeMoney) {
		this.changeMoney = changeMoney;
	}

	public java.lang.Double getChangeMoney() {
		return this.changeMoney;
	}


	public void setTakeMoney(java.lang.Double takeMoney) {
		this.takeMoney = takeMoney;
	}

	public java.lang.Double getTakeMoney() {
		return this.takeMoney;
	}


	public void setOrderMark(java.lang.String orderMark) {
		this.orderMark = orderMark;
	}

	public java.lang.String getOrderMark() {
		return this.orderMark;
	}


	public Date getSendTime() {
		return sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	public Integer getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(Integer orderStatus) {
		this.orderStatus = orderStatus;
	}

	public void setIsTakeExcept(java.lang.Integer isTakeExcept) {
		this.isTakeExcept = isTakeExcept;
	}

	public java.lang.Integer getIsTakeExcept() {
		return this.isTakeExcept;
	}


	public void setAddSendTime(java.lang.Integer addSendTime) {
		this.addSendTime = addSendTime;
	}

	public java.lang.Integer getAddSendTime() {
		return this.addSendTime;
	}


	public void setAddSendMoney(java.lang.Double addSendMoney) {
		this.addSendMoney = addSendMoney;
	}

	public java.lang.Double getAddSendMoney() {
		return this.addSendMoney;
	}


	public void setOrderLog(java.lang.String orderLog) {
		this.orderLog = orderLog;
	}

	public java.lang.String getOrderLog() {
		return this.orderLog;
	}


	public void setIsGoodsBad(java.lang.Integer isGoodsBad) {
		this.isGoodsBad = isGoodsBad;
	}

	public java.lang.Integer getIsGoodsBad() {
		return this.isGoodsBad;
	}


	public void setIsSendExcept(java.lang.Integer isSendExcept) {
		this.isSendExcept = isSendExcept;
	}

	public java.lang.Integer getIsSendExcept() {
		return this.isSendExcept;
	}


	public void setIsOk(java.lang.Integer isOk) {
		this.isOk = isOk;
	}

	public java.lang.Integer getIsOk() {
		return this.isOk;
	}

	public Integer getExceptLog() {
		return exceptLog;
	}

	public void setExceptLog(Integer exceptLog) {
		this.exceptLog = exceptLog;
	}

	public void setGmtDatetime(java.util.Date gmtDatetime) {
		this.gmtDatetime = gmtDatetime;
	}

	public java.util.Date getGmtDatetime() {
		return this.gmtDatetime;
	}


	public void setRobDatetime(java.util.Date robDatetime) {
		this.robDatetime = robDatetime;
	}

	public java.util.Date getRobDatetime() {
		return this.robDatetime;
	}


	public void setGetDatetime(java.util.Date getDatetime) {
		this.getDatetime = getDatetime;
	}

	public java.util.Date getGetDatetime() {
		return this.getDatetime;
	}


	public void setSendDatetime(java.util.Date sendDatetime) {
		this.sendDatetime = sendDatetime;
	}

	public java.util.Date getSendDatetime() {
		return this.sendDatetime;
	}


	public void setUptDatetime(java.util.Date uptDatetime) {
		this.uptDatetime = uptDatetime;
	}

	public java.util.Date getUptDatetime() {
		return this.uptDatetime;
	}

	public Integer getIsIncubatorDelivery() {
		return isIncubatorDelivery;
	}

	public void setIsIncubatorDelivery(Integer isIncubatorDelivery) {
		this.isIncubatorDelivery = isIncubatorDelivery;
	}

	public Integer getIsRebut() {
		return isRebut;
	}

	public void setIsRebut(Integer isRebut) {
		this.isRebut = isRebut;
	}

}
